<!DOCTYPE html>
<html lang="en">
<head>
    <title>登录管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/layui/css/layui.css"/>
</head>
<body>
<div class="demoTable">
    名称：
    <div class="layui-inline">
        <input class="layui-input" name="name" id="name" autocomplete="off">
    </div>
    <button class="layui-btn" id="searchBtn" data-type="reload">搜索</button>
    <input class="layui-btn" type="button" id="export" value="导出">
</div>
<table class="layui-hide" id="test" lay-filter="test"></table>
<div id="toolbar" style="display: none; ">

</div>
<script src="/layui/layui.js" charset="utf-8"></script>
<script>

    layui.use(['table', 'layer', 'form', 'jquery'], function () {
        var form = layui.form;
        var table = layui.table;
        var layer = layui.layer;
        var $ = layui.jquery;
        table.render({
            elem: '#test'
            , url: '/api/loginInfor/page'
            , page: true //开启分页
            , id: 'testReload'
            , cols: [[
                {field: "id", title: "ID", sort: true, fixed: "true"},
                {field: "username", title: "用户名称"},
                {field: "loginIp", title: "IP地址"},
                {field: "loginBroswer", title: "浏览器"},
                {field: "loginAddress", title: "位置"},
                {field: "createDatetime", title: "时间"},
                {field: "description", title: "描述"}
            ]]
            , response: {
                statusCode: 1
            }
            , parseData: (res) => {
                if (res.status == 1) {
                    return {
                        "code": res.status,
                        "msg": res.msg,
                        "count": res.total,
                        "data": res.rows
                    }
                }
            }
        })
    })

</script>
</body>
</html>